Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

deDriver_priv.hpp

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////////////////////////
00002 /// @file deDriver_priv.hpp
00003 ///
00004 /// @brief private driver implementations
00005 ///
00006 /// @author Lightning, Assassin
00007 ///
00008 /// This file is the intellectual property of Novus Delta, LLC.. Usage of the
00009 /// contents of this file is subject to the Destiny3D Member License which
00010 /// can be found at http://www.destiny3d.com.  Any other usage is prohibited.
00011 ///
00012 /// This file is distributed "AS IS" without warranty of any kind.  Novus
00013 /// Delta, LLC. does not guarantee the fitness of the contents of this file
00014 /// for any particular purpose.
00015 ///
00016 /// Copyright (C) 2001-2003 Novus Delta, LLC. All Rights Reserved.
00017 ///
00018 /// <hr>
00019 ///                                 Change History
00020 /// <hr>
00021 ///
00022 /// @date May 2002
00023 /// @author Assassin
00024 /// @remarks Initial Creation
00025 ///
00026 ///////////////////////////////////////////////////////////////////////////////
00027 
00028 #ifndef DEDRIVER_PRIV_HPP
00029 #define DEDRIVER_PRIV_HPP
00030 
00031 #include "deDriver.hpp"
00032 #include "deRenderStates.hpp"
00033 //#include <windows.h> // for various stuff (RECT, etc)
00034 
00035 class deDriver : public IdeDriver
00036 {
00037 protected:
00038     //the constructors
00039     deDriver();
00040     virtual ~deDriver();
00041 public:
00042     virtual deBoolean Init(HWND WindowHandle) = 0;
00043     //display modification functions
00044 
00045     //set the current display
00046     virtual deBoolean SetDisplay(deDisplay *Display) = 0;
00047     virtual deBoolean Reset(deDisplay *Display = NULL) = 0;
00048     const deDisplay *GetDisplay() const;
00049     virtual deBoolean GetCurrentDisplay(long Adapter, deDisplay * Display) const = 0;
00050     virtual deBoolean GetDisplayMode(long Adapter, long Mode, deDisplay *Display) const = 0;
00051     virtual const deDriverCaps* GetCaps(long Adapter) const = 0;
00052     deRect UpdateWindowRect();
00053     deRect GetDisplayRect() const;
00054     
00055     //adapter and mode counts for adapters
00056     virtual long GetAdapterCount() const = 0;
00057     virtual long GetModeCount(long Adapter) const = 0;
00058     virtual deBoolean WindowedAllowed(long Adapter) const = 0;
00059     virtual deBoolean ValidFormat(long Adapter, Resource ResourceType, BPP BPPType, ZPP ZPPType, BPP FrontBuffer, long ExtraFlag) const = 0;
00060     long BitDepth(BPP BPPType) const;
00061     long BitDepth(ZPP ZPPType) const;
00062     long StencilDepth(ZPP ZPPType) const;
00063     deBoolean HasStencil(ZPP ZPPType) const;
00064     BPP DownSampleFormat(BPP OriginalFormat) const;
00065     
00066     //vertex buffer functions
00067     virtual deBoolean AddVertexBuffer(IdeVertexBuffer *Vertex) = 0;
00068     virtual deBoolean RemoveVertexBuffer(IdeVertexBuffer *Vertex) = 0;
00069     virtual deBoolean UpdateVertexBuffer(IdeVertexBuffer *Vertex) = 0;
00070 
00071     // Shader functions
00072     virtual deBoolean AddShader(IdeShader * Shader) = 0;
00073     virtual deBoolean SetShader(IdeShader * Shader) = 0;
00074     virtual deBoolean RemoveShader(IdeShader * Shader) = 0;
00075 
00076     //frame functions
00077     virtual deBoolean BeginFrame() = 0;                             //BeginFrame must be called to start rendering
00078     virtual deBoolean EndFrame() = 0;                               //finish off the frame
00079     
00080     //allow clearing of the frame with a color
00081     virtual deBoolean ClearFrame(deARGB Color, deBoolean ClearTarget = deTRUE, deBoolean ClearZBuffer = deTRUE, deBoolean ClearStencil = deTRUE) = 0;
00082     virtual deBoolean Render(IdeVertexBuffer *Vertex, long IndexOffset, IdeVertexBuffer *IndexOverride) = 0;            //render a frame
00083 
00084     //viewport/FOV functions
00085     virtual deBoolean SetViewport(long X, long Y, long Width, long Height, deFloat MinZ, deFloat MaxZ) = 0;
00086     virtual deBoolean SetFOVClipping(deFloat FOV, deFloat Aspect, deFloat ClipNear, deFloat ClipFar) = 0;
00087     virtual deBoolean SetOrthoClipping(deFloat Width, deFloat Height, deFloat ClipNear, deFloat ClipFar, deBoolean Invert = deFALSE) = 0;
00088     virtual deBoolean SetFOVClippingSubRect(deFloat FOVY, deFloat Aspect, deFloat ClipNear, deFloat ClipFar, deRect SubRect) = 0;
00089     virtual deBoolean SetFOVClippingSubRectFloat(deFloat FOVY, deFloat Aspect, deFloat ClipNear, deFloat ClipFar, deFloatRect SubRect) = 0;
00090     virtual deBoolean SetOrthoClippingSubRect(deFloat Width, deFloat Height, deFloat ClipNear, deFloat ClipFar, deBoolean Invert, deRect SubRect) = 0;
00091     virtual deBoolean SetOrthoClippingSubRectFloat(deFloat Width, deFloat Height, deFloat ClipNear, deFloat ClipFar, deBoolean Invert, deFloatRect SubRect) = 0;
00092     virtual deBoolean SetScissorRect(deRect ScissorRect) = 0;
00093 
00094     //camera translation functions
00095     virtual deBoolean SetCameraTransform(deTransformInfo *M) = 0;
00096     virtual deBoolean SetCameraTransform(deVertex *Eye, deVertex *At, deVertex *Up) = 0;
00097     virtual deBoolean SetCameraTranslation(deVertex *Translation) = 0;
00098     virtual deBoolean SetCameraRotation(deVertex *Rotation) = 0;
00099     virtual deBoolean ResetCameraIdentity() = 0;
00100 
00101     //world translation functions
00102     virtual deBoolean SetWorldTransform(deVertex *Eye, deVertex *At, deVertex *Up) = 0;
00103     virtual deBoolean SetWorldTransform(deTransformInfo * Mat) = 0;
00104     virtual deBoolean SetWorldTranslation(deVertex *Translation) = 0;
00105     virtual deBoolean SetWorldRotation(deVertex *Rotation) = 0;
00106     virtual deBoolean ResetWorldIdentity() = 0;
00107     
00108     //texture functions
00109     virtual deBoolean AddBitmap(IdeBitmap *Bitmap) = 0;
00110     virtual deBoolean AddBitmapProxy(IdeBitmapProxy *BitmapProxy) = 0;
00111     virtual deBoolean RemoveBitmap(IdeBitmap *Bitmap) = 0;
00112     
00113     //render-to-texture functions
00114     virtual deBoolean RenderTo(IdeBitmap *Bitmap, long CubeMapFace) = 0;
00115     virtual deBoolean ScreenShot(IdeBitmap * &pBitmap, deBoolean GrabWindow) = 0;
00116     virtual deBoolean GetVideoTexture(IdeBitmap* pBitmap, long CubeMapFace) = 0;
00117     
00118     //render states
00119     virtual unsigned long GetRenderState(RenderState State) = 0;
00120     virtual deBoolean SetRenderState(const IdeRenderState *State) = 0;
00121     virtual deBoolean SetRenderState(RenderState State, unsigned long Value) = 0;
00122     virtual deBoolean EnableLight(long LightID, deBoolean Enable) = 0;
00123     virtual deBoolean DisableAllLights() = 0;
00124 
00125     unsigned long GetQualityFlag(QualityFlag Flag);
00126     deBoolean SetQualityFlag(QualityFlag Flag, unsigned long Value);
00127     
00128     //driver info
00129     virtual IdeDriver::Types GetType() const = 0;
00130     virtual deDriverInfo *GetInfo() const = 0;
00131     long GetCount();
00132 
00133     //logging info
00134     void LogInfo(char *Data, ...);
00135     deDriverStats* GetDriverStats();
00136     void ResetDriverStats();
00137     
00138 protected:
00139     //set the default renderstates for the driver
00140     void SetDefaultRenderstates();
00141     virtual void InvalidateRenderStates(deBoolean Valid) = 0;
00142 
00143     deDisplay       m_CurrentDisplay;       //current display for this driver
00144     HWND            m_CurWindowHandle;      //handle to the window this display is using
00145     long            m_UniqueID;             //unique ID for the driver entry
00146     deRect          m_ClientRect;           //client rect to use if in windowed mode
00147     deRect          m_SourceRect;           //source rect to draw from
00148     unsigned long   m_RenderStates[RENDER_COUNT];   //current state of the renderstates
00149     unsigned long   m_QualityFlags[QUALITY_FLAG_COUNT];
00150     deDriverStats   m_Stats;
00151     struct deViewport
00152     {
00153         long X, Y, Width, Height;
00154         deFloat MinZ, MaxZ;
00155     } m_CurrentViewport;        //current viewport rect
00156 };
00157 
00158 class deDriverLoad : public IdeDriverLoad
00159 {
00160 protected:
00161     deDriverLoad::~deDriverLoad();  
00162 public:
00163     //init and destroy functions
00164     deDriverLoad::deDriverLoad(char const *Path);
00165     long Release();
00166     
00167     //basic driver info functions
00168     long GetCount();
00169     const deDriverInfo *GetInfo(long DriverNumber);
00170     const deDriverInfo *GetInfo(char *DriverName);
00171     IdeDriver *GetDriver(long DriverNumber);
00172     IdeDriver *GetDriver(char *DriverName);
00173     
00174 private:
00175     //a structure to hold each driver entry (internal struct)
00176     typedef struct DriverEntry
00177     {
00178         HMODULE             DriverHandle;   //handle to driver
00179         ISDESTINY3DDRIVER   DriverProc;     //handle to IsDestiny3DDriver function
00180         GETDRIVERINSTANCE   DriverInstance; //handle to GetDriverInstance function
00181         GETDRIVERINFO       DriverInfo;     //handle to GetDriverName function
00182         char *              DLLName;        //name of DLL
00183         char *              DriverName;     //name of driver
00184         DriverEntry *       Next;           //pointer to next driver
00185     } DriverEntry;
00186     
00187     //private function
00188     DriverEntry *GetEntry(long EntryNumber);
00189     DriverEntry *GetEntry(char *DriverName);
00190     
00191     DriverEntry *   m_DriverList;
00192     long            m_DriverCount;
00193     
00194     long            m_UniqueDriverID;
00195 };
00196 
00197 
00198 #endif

Generated on Mon Sep 12 19:58:26 2005 for Destiny3D by doxygen1.3-rc3